package org.karelun.rabbit.rcp.editpart;

import org.karelun.ideaboard.gef.EditPart;
import org.karelun.ideaboard.gef.EditPartFactory;
import org.karelun.rabbit.graph.Connection;
import org.karelun.rabbit.graph.Diagram;
import org.karelun.rabbit.graph.Shape;

public class PartFactory implements EditPartFactory{

	@Override
	public EditPart createEditPart(EditPart context, Object model) {
		if(model instanceof Diagram){
			DiagramEditPart diagramEditPart = new DiagramEditPart();
			diagramEditPart.setModel(model);
			return diagramEditPart;
		}else if(model instanceof Shape){
			ShapeEditPart shapeEditPart = new ShapeEditPart();
			shapeEditPart.setModel(model);
			return shapeEditPart;
		}else if(model instanceof Connection){
			ConnectionLineEditPart editPart = new ConnectionLineEditPart();
			editPart.setModel(model);
			return editPart;
		}
		return null;
	}
}
